import * as API from '@/constants/api'

export const state = () => ({
  overview: {}
})

export const mutations = {
  overview (state, data) {
    state.overview = data
  }
}

export const actions = {
  // 矿机数据概览
  async overview ({ commit }, params) {
    const { data } = await this.$axios.$post(API.OVERVIEW, params)
    commit('overview', data)
    return data
  },
  // 获取矿机列表
  async weathPackage ({ commit }, params) {
    return await this.$axios.$post(API.WEATH_PACKAGE, params)
  },
  // 我的矿机
  async myWeath ({ commit }, params) {
    return await this.$axios.$post(API.MY_WEATH, params)
  },
  // 我的矿机
  async weathProfit ({ commit }, params) {
    return await this.$axios.$post(API.WEATH_PROFIT, params)
  },
  // 购买矿机
  async weathBuyPackage ({ commit }, params) {
    return await this.$axios.$post(API.WEATH_BUY_PACKAGE, params)
  }

}
